#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	while (n--)
	{
		int x;
		int flag = 0;
		scanf("%d", &x);
		char* p1 = (char*)malloc(x + 2);
		char* p2 = (char*)malloc(x + 2);
		char* p3 = (char*)malloc(x + 2);
		int i = 0;
		while (getchar() != '\n')
		{
			;
		}
		scanf("%s", p1);
		scanf("%s", p2);
		scanf("%s", p3);
		for (i=0; i < x; i++)
		{
			if (p3[i] == p1[i] || p3[i] == p2[i] )
			{
				flag ++;
			}
		}
		free(p1);
		free(p2);
		free(p3);
		if (flag!=x)
			printf("YES\n");
		else
			printf("NO\n");
	}
}